#!/usr/bin/python3.8.9
# -*- coding: utf-8 -*-

# @Author  : Tina Yu
# @Time    : 2021-7-11 16:07
class Restaurant:
    def __init__(self, restaurant_name, cuisine_type):
        self.restaurant_name = restaurant_name
        self.cuisine_type = cuisine_type
        self.number_served = 0

    def describe_restaurant(self):
        print("创建一个类，带有两个属性，然后有两个方法！")

    def open_restaurant(self):
        print("餐厅正在营业！")

    def set_number_served(self, served_number):
        self.number_served = served_number

    def increment_number_served(self, increment_number):
        self.number_served += increment_number


# 练习9-1（餐厅）
restaurant = Restaurant('绿茶', '川菜')

print(restaurant.restaurant_name)
print(restaurant.cuisine_type)
restaurant.describe_restaurant()
restaurant.open_restaurant()

restaurant.set_number_served(55)
print(f'当前有{restaurant.number_served}个人就餐！')

restaurant.increment_number_served(150)
print(f'累计服务{restaurant.number_served}位顾客！')


# 练习9-6（冰激凌小店）
class IceCreamStand(Restaurant):
    # 集成父类属性，并另外新增一个flavors属性
    def __init__(self, restaurant_name, cuisine_type='ice_cream'):
        super().__init__(restaurant_name, cuisine_type)
        self.flavors = []

    def show_flavors(self):
        print(f'\n各种口味的冰激凌列表如下：')
        for flavor in self.flavors:
            print(f'- {flavor}')


print('**************** 练习9-6 【冰激凌小店】***************')
ice_cream_stand = IceCreamStand('Tina的餐厅')
ice_cream_stand.flavors = ['草莓', '牛奶', '芒果']
ice_cream_stand.describe_restaurant()
ice_cream_stand.show_flavors()
